package com.bit.demo01.TestDemo;

/**
 * @program: 2022.2.23 类和对象
 * @description:
 * @author: 李鑫月
 * @create: 2022-02-23 16:37
 **/
 class Animal{
    public String name;
    public int age;

    public Animal(String name,int age){
        this.name=name;
        this.age=age;
    }
    public void eat(){
        System.out.println(this.name+"正在吃");
    }


}
class Dog extends  Animal {

    public String name="zh";
    public int age;
    public int leg;

    public Dog(String name, int age) {
        super(name, age);
    }
    public void eat(){
        System.out.println(this.name+"正在da吃");
    }
}

public class Demo {
    protected int val=9;
    public static void main(String[] args) {
        Animal a=new Dog("lisi",9);
        System.out.println(a.name);
        a.eat();
    }
}
